<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDoctorsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('c_doctors')) {
            Schema::create('c_doctors', function (Blueprint $table) {
                $table->increments('id')->comment('ID');
                $table->integer('clinic_id')->default(0)->comment('科室分类ID');
                $table->tinyInteger('service_type')->default(0)->comment('服务类型(0:全有,1:图文质询,2:电话质询)');
                $table->decimal('imagetext_price')->comment('图文价格');
                $table->decimal('phone_price')->comment('电话质询价格');
                $table->tinyInteger('online')->default(0)->comment('是否在线(1:在线,0:不在线)');
                $table->string('vocat_name', 50)->comment('医生职称');
                $table->integer('work_id')->default(0)->comment('工作室ID');
                $table->string('idcard', 100)->default(null)->comment('身份证号');
                $table->string('profile', 100)->default(null)->comment('头像');
                $table->string('front_card', 100)->default(null)->comment('身份证正面');
                $table->string('behind_card', 100)->default(null)->comment('身份证反面');
                $table->text('certificate')->default(null)->comment('相关资质证书');
                $table->string('real_name', 100)->default(null)->comment('医护名称');
                $table->string('hospital', 100)->default(null)->comment('所属医院');
                $table->text('introduce')->default(null)->comment('介绍');
                $table->text('skill')->default(null)->comment('擅长');
                $table->integer('pricesort')->default(0)->comment('价格排序字段');
                $table->integer('answer_num')->default(0)->comment('问答数');
                $table->float('good_evaluat')->comment('好评率');
                $table->integer('fans_num')->default(0)->comment('粉丝数');
                $table->string('name')->unique()->comment('名称');;
                $table->string('phone')->unique()->comment('手机号');;
                $table->string('password', 60)->comment('密码');;
                $table->string('api_token', 80)->nullable()->default(null)->comment('登录token');;
                $table->string('remarks', 255)->nullable()->default(null)->comment('备注');
                $table->timestamps();
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('c_doctors');
    }
}
